﻿<cfsilent>
	<cfscript>

		event.setArg("pageTitle", "外语等级考试 - 导入考试成绩");
		
		/* 四六级成绩分布情况 */
		sql= "SELECT 
				t_class.grade, count(*) scroll_count, 
				sum( CASE WHEN exam_id = 'CET4' THEN 1 ELSE 0 END ) cet4_count, 
				sum( CASE WHEN exam_id = 'CET6' THEN 1 ELSE 0 END ) cet6_count, 
				sum( CASE WHEN exam_id = 'CJT4' THEN 1 ELSE 0 END ) cjt4_count, 
				sum( CASE WHEN exam_id = 'CJT6' THEN 1 ELSE 0 END ) cjt6_count, 
				sum( CASE WHEN exam_id = 'CRT4' THEN 1 ELSE 0 END ) crt4_count, 
				sum( CASE WHEN exam_id = 'CRT6' THEN 1 ELSE 0 END ) crt6_count 
				FROM t_cet_scroll 
				INNER JOIN t_student ON t_student.stu_id = t_cet_scroll.stu_id 
				INNER JOIN t_class ON t_class.cls_id = t_student.cls_id 
				GROUP BY t_class.grade 
				ORDER BY t_class.grade DESC ";
		
		queryObj = new Query( datasource=application.dnsSlave );

		rs_cet = queryObj.execute( sql=sql ).getResult();
		
		currentTab = event.getArg("TabID", "labImport");
		
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('cetAnalyse')#</cfoutput>"><i class="mrs img btnPublish"></i><span class="uiButtonText">过级率分析报告</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 db"></i>导入CET考试成绩
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="create">
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labSummary">class="active"</cfif> id="labSummary" tabTarget="Summary">成绩数据统计</span>
						<span <cfif currentTab eq "labImport">class="active"</cfif> id="labImport" tabTarget="Import">导入成绩数据</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					
					// -->
					//]]>
				</script>
				
				<div id="Summary" class="tabContent">
					
					<div class="noticeBlock">
						<h3>CET成绩记录</h3>
						<hr/>
					</div>
					
					<cfif rs_cet.recordCount >
						
							<table class="UItable">
								<tr class="cellBorder cellCenter">
									<td>年级</td>
									<td>考生数</td>
									<td><span class="number">CET4</span></td>
									<td><span class="number">CET6</span></td>
									<td><span class="number">CJT4</span></td>
									<td><span class="number">CJT6</span></td>
									<td><span class="number">CRT4</span></td>
									<td><span class="number">CRT6</span></td>
								</tr>
								<cfloop query="rs_cet">
									<tr class="cellBorder cellCenter">
										<td><span class="number"><cfoutput>#rs_cet.grade#</cfoutput></span></td>
										<td><span class="number"><cfoutput>#rs_cet.scroll_count#</cfoutput></span></td>
										<td><span class="number"><cfoutput>#rs_cet.cet4_count#</cfoutput></span></td>
										<td><span class="number"><cfoutput>#rs_cet.cet6_count#</cfoutput></span></td>
										<td><span class="number"><cfoutput>#rs_cet.cjt4_count#</cfoutput></span></td>
										<td><span class="number"><cfoutput>#rs_cet.cjt6_count#</cfoutput></span></td>
										<td><span class="number"><cfoutput>#rs_cet.crt4_count#</cfoutput></span></td>
										<td><span class="number"><cfoutput>#rs_cet.crt6_count#</cfoutput></span></td>
									</tr>
								</cfloop>
							</table>
							
						<cfelse>
						
							<div class="systemNotice">
								<p>还没有历史成绩记录</p>
							</div>
							
					</cfif>
					
					
				</div>

				<div id="Import" class="tabContent">
					
					<div class="noticeBlock">
						<h3>导入CET成绩</h3>
						<p><span class="img icon16x16 message"></span>请严格按照如下的数据模板在电子表格文件对应行填入CET成绩数据. 点击<a href="<cfoutput>#buildURL('importCETTemplate')#</cfoutput>">下载成绩录入模板</a>, 在录入信息时请勿更改第一行表头内容.</p>
						<hr/>
						<table>
							<tr>								
								<td>准考证</td>
								<td>语言级别</td>
								<td>学号</td><td>缺考</td><td>总分</td><td>听力分数</td><td>阅读分数</td><td>写作分数</td><td>综合测试分数</td>
							</tr>
							<tr>
								<td>CET准考证号</td>
								<td>CET4/CET6</td>
								<td>校内考生学号</td>
								<td>缺 或 空</td>
								<td>382</td><td>118</td><td>133</td><td>91</td><td>40</td>
							</tr>
						</table>
						<hr/>
					</div>
					
					<form target="output" onSubmit="javascript:return processVerfiyForm('formImport');" id="formImport" class="formWrapper" method="post" enctype="multipart/form-data" action="<cfoutput>#buildURL('cetImportDo')#</cfoutput>">
						
						<div class="label">
							<span class="req">*</span><b>导入数据文件</b>
							<input name="upload" id="upload" type="file" verification="required" />
						</div>
						
						<div class="lable"><input id="importTrigger" class="button" type="submit" value="导入CET成绩" /></div>
					</form>
					
					<script language="javascript" type="text/javascript">
						//<![CDATA[
						<!--
						$(document).ready(function() {
							$("#importTrigger").click(function(){
								$("#output").attr("src","about:blank").removeClass("hidden_elem");
							});
						});
						// -->
						//]]>
					</script>
					
					
					<iframe name="output" id="output" class="UIframeBox hidden_elem" src="about:blank" frameborder="0"></iframe>
					
				</div>
				
			</div>
		</li>
	</ul>
</div>
